Add (targets)

Adds a new target to an existing target object for targeting (and filtering) embedded dashboard content.

add(name: string, filter: Filter, isOlap?: Boolean): Target
  • Provide the name of the target. The targets are named in the Present dashboard template.
  • The filters are one or more embed based filters.
  • The isOlap flag is designed to indicate if the target filters are for an MDX based datasource.
  • You can chain a set of "add" functions to built a composite of targets.

Example

The following example creates 2 sets of filters: 'dateFilter' for dates, and 'countryFilter' for countries. Each filter is then directed to a specified target ('Target1' and 'Target2', as named in the dashboard). These targets are then attached to the embed method using the EmbedOptions object.

var dateFilter = Filter.create().add("dates", "years", "2020"); var countryFilter = Filter.create().add("customers", "country", "USA").add("customers", "country", "AU"); var targets = Target.create().add(dateFilter, "Target1", false).add(countryFilter, "Target2", false); var container = document.getElementById("myContainer"); client.embed(container, { contentId: "c20d42b4-be24-47cf-b711-d5782f048590", targets: targets, });